package com.vgulu.server.common.exception;

/**
 * Created by wangchunsee on 16/1/12.
 */
public enum ErrorCode {
    OK(0, ""),

    //登录
    MOBILE_NOT_REGISTER     (100100, "手机未注册"),
    PASSWORD_ERROR          (100101, "密码错误"),


    //注册
    MOBILE_HAD_REGISTER     (100102, "手机已注册"),
    SMS_CODE_ERROR          (100103, "验证码错误"),

    //创建token失败
    CREATE_TOKEN_ERROR      (100105, "创建Token失败"),
    USER_NOT_EXIST          (100109, "用户不存在"),

    ACCESS_TOKEN_ERROR      (100104, "Token校验失败"),
    /****** 操作相关错误 ******/
//
    APP_ID_INVALID       (100200, "APP ID 不正确"),
    WX_CODE_INVALID      (100201, "Code错误,登录失败"),
//
    WX_LOGIN_API_ERROR      (100300, "微信登录接口错误"),
//    CONVERT_MERCHANT_ERR    (100301, "该商家账户未设置积分转换"),
//
//    REDEEM_FAIL             (100400, "用于购买的支付失败"),
//    REDEEM_PAY_POINT_ERR    (100401, "积分支付失败"),
//    REDEEM_PAY_CASH_ERR     (100402, "现金支付失败"),
//    REDEEM_MERCHANT_ERR     (100403, "该商家账户未设置商户代码"),
//    REDEEM_PAY_TWICE        (100404, "重复支付"),
//
//    REWARD_FAIL             (100500, "奖励积分失败"),
//
//    CHARGE_POINT_FAIL       (100600, "积分充值失败"),
//    CHARGE_NOT_REDEEM       (100601, "未完成支付"),
//
//    RECEIVE_CASH_FAIL       (100700, "现金转入失败"),
//
//    CANCEL_FAIL             (100800, "取消交易单失败"),
//    CANCEL_INVALID_STATUS   (100801, "订单状态不可取消"),
//    CANCEL_KEEP_ERR         (100802, "没有足够资产可扣除"),
//    CANCEL_POINT_ERR        (100803, "积分回退失败"),
//    CANCEL_CASH_ERR         (100804, "现金回退失败"),
//    CANCEL_TWICE            (100805, "重复取消"),
//
//    SETTINGS_ACCOUNT_ERR    (100901, "不正确商户账户"),
//    SETTINGS_ARG_ERR        (100902, "商家设置参数不正确"),
//    SETTINGS_NOT_SET        (100903, "无法保存商家设置"),
//    SETTINGS_NOT_FOUND      (100904, "商家设置不存在"),
//
//    QUERY_NO_ACCOUNT        (101001, "账户不存在"),
//
//    ADAPTER_FAIL            (101101, "向第三方请求失败"),
//
//
//    COMPANY_PAY_ERR         (101200, "企业支付失败"),
//    COMPANY_PAY_TWICE       (101201, "企业支付重复"),
//    COMPANY_PAY_AMOUNT_NOT_ENOUGH(101202, "企业帐号资金余额不足"),
//    COMPANY_PAY_ACCOUNT_TYPE_ERR (101203,"企业挂账帐号类型不匹配"),

    /****** 一般错误 ******/

    PARAM_ERR          (200000, "缺少必须的参数"),
    FAIL               (100000, "内部错误"), ;


    private int code;
    private String msg;

    private ErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public VBaseException toException() {
        return new VBaseException(code,msg);
    }

}
